<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="IE=edge" http-equiv="X-UA-Compatible">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <title>Document</title>
    <style>
        iframe {
            border: none;
            overflow: hidden;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            min-height: 100vh;
            background: linear-gradient(to bottom, transparent, transparent);
        }

        .nav {
            width: 250px;
            height: 50px;
            background-color: #ff00a9;
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 100;
        }

        .toggle {
            width: 100%;
            height: 50px;
            display: flex;
            justify-content: flex-end;
            align-items: center;
            cursor: pointer;
            color: #b910a2;
            padding: 5px 20px;
        }

        .toggle::before {
            content: 'Menu';
            margin-right: 10px;
        }

        .toggle span {
            position: relative;
            width: 20px;
            height: 50px;
        }

        .toggle span::before {
            content: '';
            position: absolute;
            top: 20px;
            left: 0;
            width: 100%;
            height: 2px;
            background-color: #7e006f;
            transition: 0.5s;
        }

        .toggle span::after {
            content: '';
            position: absolute;
            bottom: 20px;
            left: 0;
            width: 100%;
            height: 2px;
            background-color: #68064e;
            transition: 0.5s;
        }

        .toggle.active span::before {
            transform: rotate(225deg);
            top: 24px;
        }

       .toggle.active span::after {
            transform: rotate(135deg);
            bottom: 24px;
        }


        .h ul {
            position: relative;
            list-style: none;
            display: flex;
            flex-direction: column;
        }

        .h ul li {
            height: 50px;
            padding: 10px 20px;
            background-color: #a51996;
            color: #9751c7;
            cursor: pointer;
            position: relative;
            list-style: none;

            transition: .5s;
            visibility: hidden;
            opacity: 0;
            transform: translateX(-250px);
            transition-delay: calc(0.1s * var(--i));
        }

        .nav.active li {
            visibility: visible;
            opacity: 1;
            transform: translateX(0px);
        }

    </style>
</head>
<body>
<div class="nav h">

    <!-- 菜单切换部分 -->
    <div class="toggle">
        <span></span>
    </div>
    <!-- 列表部分 -->
    <ul>
        <li style="--i:0">主菜单</li>
        <li onclick="function ShoppingCart() {
            window.location.href='shopcar.jsp';
        }
        ShoppingCart()" style="--i:2">购物车
        </li>

        <li onclick="function account() {
            window.location.href='index.jsp';
        }
        account()" style="--i:3">账户

        <li onclick="function about() {
            window.location.href='upload.html';
        }
        about()" style="--i:4">关于
        <li onclick="function set() {
            window.location.href='upload.html';
        }
       set()" style="--i:1">设置
    </ul>
</div>
<script>
    let nav = document.querySelector('.nav')
    let toggle = document.querySelector('.toggle')


    toggle.addEventListener('click', () => {
        toggle.classList.toggle('active')
        nav.classList.toggle('active')
    })

</script>
</body>
</html>